﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PhysicalRigSet : MonoBehaviour
{
    public Transform[] rigs;
    public PhysicalRig rigsCom;
    // Use this for initialization
    void Start()
    {
        foreach (var rig in rigs)
        {
            var pr = rig.GetComOrAdd<PhysicalRig>();
            var list = new List<Transform>();
            pr.GetComponentsInChildren(list);
            list.RemoveAt(0);
            pr.bones = list.ToArray();
            string code = "";
            for (int i = 0; i < pr.bones.Length; i++)
            {
                code += (i + 1).ToString();
            }
            pr.chainCodes = new string[] { code + "p1" };
            pr.oneWaySpring = true;
            pr.oneWayResetLength = true;
            pr.gravity = Vector3.up * -0.01f;            
        }
    }

    // Update is called once per frame
    void Update()
    {

    }
}
